

<template>
    <van-cell title="头像" is-link to="/user/edit">
        <img style="height: 40px;width:40px" :src="user.avatarUrl"/>
    </van-cell>
  <van-cell title="昵称" is-link :value="user.username" to="/user/edit" @click="toEdit('username','昵称',user.username)"/>
  <van-cell title="账号"  :value="user.userAccount"/>
  <van-cell title="性别" is-link  :value="user.gender" @click="toEdit('gender', '性别',user.gender)"/>
  <van-cell title="电话" is-link  :value="user.phone" to="/user/edit" @click="toEdit('phone','电话',user.phone)"/>
  <van-cell title="邮箱" is-link  :value="user.email" to="/user/edit" @click="toEdit('email','邮箱',user.email)"/>
  <van-cell title="星球编号" is-link :value="user.plantCode" @click="toEdit('plantCode','星球编号',user.plantCode)"/>
  <van-cell title="注册时间" :value="user.createTime.toISOString()" style="min-width:70%"/>

</template>

<script setup lang="ts">

  import {useRouter} from "vue-router";

  const user = {
    id: 1,
    username: 'Dreamer',
    userAccount: 'joyousmoment',
    avatarUrl: 'http://gitlab.code-nav.cn/uploads/-/system/user/avatar/11831/avatar.png?width=400',
    profile: '',
    gender:'男',
    phone: '15113511128',
    email: 'joyousmoment@163.com',
    plantCode: '1234',
    tags: '',
    createTime: new Date(),

  }

  const router = useRouter();


  const toEdit = (editKey:string,editName:string,currentValue:string) =>{
      router.push({
          path: '/user/edit',
          query:{
              editKey,
              editName,
              currentValue,
          }
      })
  }

</script>


<style scoped>

</style>